<?php

namespace app\common\validate;

class AdminGroupValidate extends BaseValidate
{
    /**
     * 验证规则
     *
     * @var array
     */
    protected $rule = [
        'page_index'   => 'require|integer|gt:0',
        'page_size'    => 'require|integer|gt:0',
        'order_type'   => 'requireWith:order_field|in:asc,desc',
        'order_field'  => 'requireWith:order_type|in:id,username,group_id,nickname,last_login,status,create_time,update_time',
    ];
    /**
     * 验证规则
     */
    protected $field = [
        'group_title'    => '用户组名称',
        'status'    => '状态',
        'menu_rules'    => '菜单权限',
        'api_rules'    => '接口权限',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'addAdminGroupItem' => [
            'group_title'    => 'require',
            'status'    => 'require|in:0,1',
            'menu_rules'    => 'require|array',
            'api_rules'    => 'require|array',
        ],
        'setAdminGroupItem' =>[
            'group_title'    => 'require',
            'group_id'    => 'require',
            'status'    => 'require|in:0,1',
            'menu_rules'    => 'require|array',
            'api_rules'    => 'require|array',
        ],
        'delAdminGroupItem' =>[
            'group_id'    => 'require',
        ]
    ];


}
